package android.features.receivers;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.features.services.CallFinderService;
import android.telephony.TelephonyManager;
import android.util.Log;

public class SampleReceiver extends BroadcastReceiver {

	private static final String CLASSTAG = SampleReceiver.class.getName();
	@Override
	public void onReceive(Context context, Intent intent) {
		
		if (intent.getAction().equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {

			String status = intent.getStringExtra(TelephonyManager.EXTRA_STATE);

			if (status.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
				Log.d(CLASSTAG, "Starting CallFetcherService");
				context.startService(new Intent(context, CallFinderService.class));
			}
		}

	}

}
